From: Siebrand Mazeland Date: Mon, 25 Mar 2013 22:52:41 +0000 (+0100) Subject: Update code formatting X-Git-Tag: 1.31.0-rc.0~20207 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=80f4ee1720706211032526644c41a5b5d36d0bfa;p=lhc%2Fweb%2Fwiklou.git Update code formatting Used PHPStorm's code formatting feature, with manual checks and updates. Change-Id: I0496eba007056bc9c4b09163387f11d6cea2a55d --- diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index a60c8efeab..855d409bde 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -53,7 +53,7 @@ class SpecialAllmessages extends SpecialPage { $this->setHeaders(); global $wgUseDatabaseMessages; - if( !$wgUseDatabaseMessages ) { + if ( !$wgUseDatabaseMessages ) { $out->addWikiMsg( 'allmessagesnotsupportedDB' ); return; } else { @@ -121,15 +121,15 @@ class AllmessagesTablePager extends TablePager { $request = $this->getRequest(); $this->filter = $request->getVal( 'filter', 'all' ); - if( $this->filter === 'all' ) { + if ( $this->filter === 'all' ) { $this->custom = null; // So won't match in either case } else { - $this->custom = ($this->filter == 'unmodified'); + $this->custom = ( $this->filter == 'unmodified' ); } $prefix = $this->getLanguage()->ucfirst( $request->getVal( 'prefix', '' ) ); $prefix = $prefix != '' ? Title::makeTitleSafe( NS_MEDIAWIKI, $request->getVal( 'prefix', null ) ) : null; - if( $prefix !== null ) { + if ( $prefix !== null ) { $this->displayPrefix = $prefix->getDBkey(); $this->prefix = '/^' . preg_quote( $this->displayPrefix ) . '/i'; } else { @@ -139,7 +139,7 @@ class AllmessagesTablePager extends TablePager { // The suffix that may be needed for message names if we're in a // different language (eg [[MediaWiki:Foo/fr]]: $suffix = '/fr' - if( $this->foreign ) { + if ( $this->foreign ) { $this->suffix = '/' . $this->langcode; } else { $this->suffix = ''; @@ -159,36 +159,36 @@ class AllmessagesTablePager extends TablePager { Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" . ' ' . - Xml::label( $this->msg( 'allmessages-prefix' )->text(), 'mw-allmessages-form-prefix' ) . - "\n - " . - Xml::input( 'prefix', 20, str_replace( '_', ' ', $this->displayPrefix ), array( 'id' => 'mw-allmessages-form-prefix' ) ) . - "\n + Xml::label( $this->msg( 'allmessages-prefix' )->text(), 'mw-allmessages-form-prefix' ) . + "\n + " . + Xml::input( 'prefix', 20, str_replace( '_', ' ', $this->displayPrefix ), array( 'id' => 'mw-allmessages-form-prefix' ) ) . + "\n \n - " . - $this->msg( 'allmessages-filter' )->escaped() . - "\n + " . + $this->msg( 'allmessages-filter' )->escaped() . + "\n " . - Xml::radioLabel( $this->msg( 'allmessages-filter-unmodified' )->text(), - 'filter', - 'unmodified', - 'mw-allmessages-form-filter-unmodified', - ( $this->filter == 'unmodified' ) - ) . - Xml::radioLabel( $this->msg( 'allmessages-filter-all' )->text(), - 'filter', - 'all', - 'mw-allmessages-form-filter-all', - ( $this->filter == 'all' ) - ) . - Xml::radioLabel( $this->msg( 'allmessages-filter-modified' )->text(), - 'filter', - 'modified', - 'mw-allmessages-form-filter-modified', - ( $this->filter == 'modified' ) - ) . - "\n + Xml::radioLabel( $this->msg( 'allmessages-filter-unmodified' )->text(), + 'filter', + 'unmodified', + 'mw-allmessages-form-filter-unmodified', + ( $this->filter == 'unmodified' ) + ) . + Xml::radioLabel( $this->msg( 'allmessages-filter-all' )->text(), + 'filter', + 'all', + 'mw-allmessages-form-filter-all', + ( $this->filter == 'all' ) + ) . + Xml::radioLabel( $this->msg( 'allmessages-filter-modified' )->text(), + 'filter', + 'modified', + 'mw-allmessages-form-filter-modified', + ( $this->filter == 'modified' ) + ) . + "\n \n " . $langSelect[0] . "\n @@ -197,16 +197,16 @@ class AllmessagesTablePager extends TablePager { ' ' . - Xml::label( $this->msg( 'table_pager_limit_label' )->text(), 'mw-table_pager_limit_label' ) . - ' - ' . - $this->getLimitSelect() . - ' + Xml::label( $this->msg( 'table_pager_limit_label' )->text(), 'mw-table_pager_limit_label' ) . + ' + ' . + $this->getLimitSelect() . + ' ' . - Xml::submitButton( $this->msg( 'allmessages-filter-submit' )->text() ) . - "\n + Xml::submitButton( $this->msg( 'allmessages-filter-submit' )->text() ) . + "\n " . Xml::closeElement( 'table' ) . @@ -219,7 +219,7 @@ class AllmessagesTablePager extends TablePager { function getAllMessages( $descending ) { wfProfileIn( __METHOD__ ); $messageNames = Language::getLocalisationCache()->getSubitemList( 'en', 'messages' ); - if( $descending ) { + if ( $descending ) { rsort( $messageNames ); } else { asort( $messageNames ); @@ -260,18 +260,19 @@ class AllmessagesTablePager extends TablePager { foreach ( $res as $s ) { $exists = false; - if( $foreign ) { + if ( $foreign ) { $title = explode( '/', $s->page_title ); - if( count( $title ) === 2 && $langcode == $title[1] - && isset( $xNames[$title[0]] ) ) { + if ( count( $title ) === 2 && $langcode == $title[1] + && isset( $xNames[$title[0]] ) + ) { $exists = $title[0]; } - } elseif( isset( $xNames[$s->page_title] ) ) { + } elseif ( isset( $xNames[$s->page_title] ) ) { $exists = $s->page_title; } - if( $exists && $s->page_namespace == NS_MEDIAWIKI ) { + if ( $exists && $s->page_namespace == NS_MEDIAWIKI ) { $pageFlags[$exists] = true; - } elseif( $exists && $s->page_namespace == NS_MEDIAWIKI_TALK ) { + } elseif ( $exists && $s->page_namespace == NS_MEDIAWIKI_TALK ) { $talkFlags[$exists] = true; } } @@ -293,24 +294,25 @@ class AllmessagesTablePager extends TablePager { $statuses = self::getCustomisedStatuses( $messageNames, $this->langcode, $this->foreign ); $count = 0; - foreach( $messageNames as $key ) { + foreach ( $messageNames as $key ) { $customised = isset( $statuses['pages'][$key] ); - if( $customised !== $this->custom && + if ( $customised !== $this->custom && ( $descending && ( $key < $offset || !$offset ) || !$descending && $key > $offset ) && ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix === false ) ) { $actual = wfMessage( $key )->inLanguage( $this->langcode )->plain(); $default = wfMessage( $key )->inLanguage( $this->langcode )->useDatabase( false )->plain(); $result->result[] = array( - 'am_title' => $key, - 'am_actual' => $actual, - 'am_default' => $default, + 'am_title' => $key, + 'am_actual' => $actual, + 'am_default' => $default, 'am_customised' => $customised, 'am_talk_exists' => isset( $statuses['talks'][$key] ) ); $count++; } - if( $count == $limit ) { + + if ( $count == $limit ) { break; } } @@ -321,26 +323,26 @@ class AllmessagesTablePager extends TablePager { return Xml::openElement( 'table', array( 'class' => 'mw-datatable TablePager', 'id' => 'mw-allmessagestable' ) ) . "\n" . " " . - $this->msg( 'allmessagesname' )->escaped() . " + $this->msg( 'allmessagesname' )->escaped() . " " . - $this->msg( 'allmessagesdefault' )->escaped() . - " + $this->msg( 'allmessagesdefault' )->escaped() . + " \n " . - $this->msg( 'allmessagescurrent' )->escaped() . - " + $this->msg( 'allmessagescurrent' )->escaped() . + " \n"; } function formatValue( $field, $value ) { - switch( $field ) { + switch ( $field ) { case 'am_title' : $title = Title::makeTitle( NS_MEDIAWIKI, $value . $this->suffix ); $talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix ); - if( $this->mCurrentRow->am_customised ) { + if ( $this->mCurrentRow->am_customised ) { $title = Linker::linkKnown( $title, $this->getLanguage()->lcfirst( $value ) ); } else { $title = Linker::link( @@ -376,7 +378,7 @@ class AllmessagesTablePager extends TablePager { $s = parent::formatRow( $row ); // But if there's a customised message, add that too. - if( $row->am_customised ) { + if ( $row->am_customised ) { $s .= Xml::openElement( 'tr', $this->getRowAttrs( $row, true ) ); $formatted = strval( $this->formatValue( 'am_actual', $row->am_actual ) ); if ( $formatted == '' ) { @@ -390,19 +392,19 @@ class AllmessagesTablePager extends TablePager { function getRowAttrs( $row, $isSecond = false ) { $arr = array(); - if( $row->am_customised ) { + if ( $row->am_customised ) { $arr['class'] = 'allmessages-customised'; } - if( !$isSecond ) { + if ( !$isSecond ) { $arr['id'] = Sanitizer::escapeId( 'msg_' . $this->getLanguage()->lcfirst( $row->am_title ) ); } return $arr; } function getCellAttrs( $field, $value ) { - if( $this->mCurrentRow->am_customised && $field == 'am_title' ) { + if ( $this->mCurrentRow->am_customised && $field == 'am_title' ) { return array( 'rowspan' => '2', 'class' => $field ); - } elseif( $field == 'am_title' ) { + } elseif ( $field == 'am_title' ) { return array( 'class' => $field ); } else { return array( 'lang' => $this->langcode, 'dir' => $this->lang->getDir(), 'class' => $field ); diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index 084d752cbe..f8b6d4ec51 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -89,14 +89,14 @@ class SpecialAllpages extends IncludableSpecialPage { $out->setPageTitle( ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) ? - $this->msg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) : - $this->msg( 'allarticles' ) + $this->msg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) : + $this->msg( 'allarticles' ) ); $out->addModuleStyles( 'mediawiki.special' ); - if( $par !== null ) { + if ( $par !== null ) { $this->showChunk( $namespace, $par, $to, $hideredirects ); - } elseif( $from !== null && $to === null ) { + } elseif ( $from !== null && $to === null ) { $this->showChunk( $namespace, $from, $to, $hideredirects ); } else { $this->showToplevel( $namespace, $from, $to, $hideredirects ); @@ -188,10 +188,13 @@ class SpecialAllpages extends IncludableSpecialPage { $from = ( $from && $from->isLocal() ) ? $from->getDBkey() : null; $to = ( $to && $to->isLocal() ) ? $to->getDBkey() : null; - if( isset( $from ) ) + if ( isset( $from ) ) { $where[] = 'page_title >= ' . $dbr->addQuotes( $from ); - if( isset( $to ) ) + } + + if ( isset( $to ) ) { $where[] = 'page_title <= ' . $dbr->addQuotes( $to ); + } global $wgMemc; $key = wfMemcKey( 'allpages', 'ns', $namespace, sha1( $from ), sha1( $to ) ); @@ -201,7 +204,7 @@ class SpecialAllpages extends IncludableSpecialPage { $maxPerSubpage = intval( $count / $this->maxLineCount ); $maxPerSubpage = max( $maxPerSubpage, $this->maxPerPage ); - if( !is_array( $lines ) ) { + if ( !is_array( $lines ) ) { $options = array( 'LIMIT' => 1 ); $options['ORDER BY'] = 'page_title ASC'; $firstTitle = $dbr->selectField( 'page', 'page_title', $where, __METHOD__, $options ); @@ -210,7 +213,7 @@ class SpecialAllpages extends IncludableSpecialPage { $lines = array( $firstTitle ); # If we are going to show n rows, we need n+1 queries to find the relevant titles. $done = false; - while( !$done ) { + while ( !$done ) { // Fetch the last title of this chunk and the first of the next $chunk = ( $lastTitle === false ) ? array() @@ -223,7 +226,7 @@ class SpecialAllpages extends IncludableSpecialPage { ); $s = $dbr->fetchObject( $res ); - if( $s ) { + if ( $s ) { array_push( $lines, $s->page_title ); } else { // Final chunk, but ended prematurely. Go back and find the end. @@ -233,8 +236,9 @@ class SpecialAllpages extends IncludableSpecialPage { array_push( $lines, $endTitle ); $done = true; } + $s = $res->fetchObject(); - if( $s ) { + if ( $s ) { array_push( $lines, $s->page_title ); $lastTitle = $s->page_title; } else { @@ -249,8 +253,8 @@ class SpecialAllpages extends IncludableSpecialPage { // If there are only two or less sections, don't even display them. // Instead, display the first section directly. - if( count( $lines ) <= 2 ) { - if( !empty( $lines ) ) { + if ( count( $lines ) <= 2 ) { + if ( !empty( $lines ) ) { $this->showChunk( $namespace, $from, $to, $hideredirects ); } else { $output->addHTML( $this->namespaceForm( $namespace, $from, $to, $hideredirects ) ); @@ -260,7 +264,7 @@ class SpecialAllpages extends IncludableSpecialPage { # At this point, $lines should contain an even number of elements. $out .= Xml::openElement( 'table', array( 'class' => 'allpageslist' ) ); - while( count ( $lines ) > 0 ) { + while ( count( $lines ) > 0 ) { $inpoint = array_shift( $lines ); $outpoint = array_shift( $lines ); $out .= $this->showline( $inpoint, $outpoint, $namespace, $hideredirects ); @@ -269,19 +273,19 @@ class SpecialAllpages extends IncludableSpecialPage { $nsForm = $this->namespaceForm( $namespace, $from, $to, $hideredirects ); # Is there more? - if( $this->including() ) { + if ( $this->including() ) { $out2 = ''; } else { - if( isset( $from ) || isset( $to ) ) { - $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ). - ' + if ( isset( $from ) || isset( $to ) ) { + $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ) . + ' ' . - $nsForm . - ' + $nsForm . + ' ' . - Linker::link( $this->getTitle(), $this->msg( 'allpages' )->escaped(), - array(), array(), 'known' ) . - " + Linker::link( $this->getTitle(), $this->msg( 'allpages' )->escaped(), + array(), array(), 'known' ) . + " " . Xml::closeElement( 'table' ); } else { @@ -365,7 +369,7 @@ class SpecialAllpages extends IncludableSpecialPage { $conds['page_is_redirect'] = 0; } - if( $toKey !== "" ) { + if ( $toKey !== "" ) { $conds[] = 'page_title <= ' . $dbr->addQuotes( $toKey ); } @@ -374,33 +378,36 @@ class SpecialAllpages extends IncludableSpecialPage { $conds, __METHOD__, array( - 'ORDER BY' => 'page_title', - 'LIMIT' => $this->maxPerPage + 1, + 'ORDER BY' => 'page_title', + 'LIMIT' => $this->maxPerPage + 1, 'USE INDEX' => 'name_title', ) ); - if( $res->numRows() > 0 ) { + if ( $res->numRows() > 0 ) { $out = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-chunk' ) ); - while( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { + while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { $t = Title::newFromRow( $s ); - if( $t ) { + if ( $t ) { $link = ( $s->page_is_redirect ? '
' : '' ) . Linker::link( $t ) . - ($s->page_is_redirect ? '
' : '' ); + ( $s->page_is_redirect ? '' : '' ); } else { $link = '[[' . htmlspecialchars( $s->page_title ) . ']]'; } - if( $n % 3 == 0 ) { + + if ( $n % 3 == 0 ) { $out .= ''; } + $out .= "$link"; $n++; - if( $n % 3 == 0 ) { + if ( $n % 3 == 0 ) { $out .= "\n"; } } - if( ($n % 3) != 0 ) { + + if ( ( $n % 3 ) != 0 ) { $out .= "\n"; } $out .= Xml::closeElement( 'table' ); @@ -412,7 +419,7 @@ class SpecialAllpages extends IncludableSpecialPage { if ( $this->including() ) { $out2 = ''; } else { - if( $from == '' ) { + if ( $from == '' ) { // First chunk; no previous link. $prevTitle = null; } else { @@ -429,20 +436,20 @@ class SpecialAllpages extends IncludableSpecialPage { ); # Get first title of previous complete chunk - if( $dbr->numrows( $res_prev ) >= $this->maxPerPage ) { + if ( $dbr->numrows( $res_prev ) >= $this->maxPerPage ) { $pt = $dbr->fetchObject( $res_prev ); $prevTitle = Title::makeTitle( $namespace, $pt->page_title ); } else { # The previous chunk is not complete, need to link to the very first title # available in the database $options = array( 'LIMIT' => 1 ); - if ( ! $dbr->implicitOrderby() ) { + if ( !$dbr->implicitOrderby() ) { $options['ORDER BY'] = 'page_title'; } $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), __METHOD__, $options ); # Show the previous link if it s not the current requested chunk - if( $from != $reallyFirstPage_title ) { + if ( $from != $reallyFirstPage_title ) { $prevTitle = Title::makeTitle( $namespace, $reallyFirstPage_title ); } else { $prevTitle = null; @@ -453,23 +460,25 @@ class SpecialAllpages extends IncludableSpecialPage { $self = $this->getTitle(); $nsForm = $this->namespaceForm( $namespace, $from, $to, $hideredirects ); - $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ). - ' + $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ) . + ' ' . - $nsForm . - ' + $nsForm . + ' ' . - Linker::link( $self, $this->msg( 'allpages' )->escaped() ); + Linker::link( $self, $this->msg( 'allpages' )->escaped() ); # Do we put a previous link ? - if( isset( $prevTitle ) && $pt = $prevTitle->getText() ) { + if ( isset( $prevTitle ) && $pt = $prevTitle->getText() ) { $query = array( 'from' => $prevTitle->getText() ); - if( $namespace ) + if ( $namespace ) { $query['namespace'] = $namespace; + } - if( $hideredirects ) + if ( $hideredirects ) { $query['hideredirects'] = $hideredirects; + } $prevLink = Linker::linkKnown( $self, @@ -480,16 +489,18 @@ class SpecialAllpages extends IncludableSpecialPage { $out2 = $this->getLanguage()->pipeList( array( $out2, $prevLink ) ); } - if( $n == $this->maxPerPage && $s = $res->fetchObject() ) { + if ( $n == $this->maxPerPage && $s = $res->fetchObject() ) { # $s is the first link of the next chunk $t = Title::makeTitle( $namespace, $s->page_title ); $query = array( 'from' => $t->getText() ); - if( $namespace ) + if ( $namespace ) { $query['namespace'] = $namespace; + } - if( $hideredirects ) + if ( $hideredirects ) { $query['hideredirects'] = $hideredirects; + } $nextLink = Linker::linkKnown( $self, @@ -505,15 +516,21 @@ class SpecialAllpages extends IncludableSpecialPage { $output->addHTML( $out2 . $out ); $links = array(); - if ( isset( $prevLink ) ) $links[] = $prevLink; - if ( isset( $nextLink ) ) $links[] = $nextLink; + if ( isset( $prevLink ) ) { + $links[] = $prevLink; + } + + if ( isset( $nextLink ) ) { + $links[] = $nextLink; + } if ( count( $links ) ) { $output->addHTML( Html::element( 'hr' ) . - Html::rawElement( 'div', array( 'class' => 'mw-allpages-nav' ), - $this->getLanguage()->pipeList( $links ) - ) ); + Html::rawElement( 'div', array( 'class' => 'mw-allpages-nav' ), + $this->getLanguage()->pipeList( $links ) + ) + ); } } @@ -524,8 +541,10 @@ class SpecialAllpages extends IncludableSpecialPage { * @return array( int namespace, string dbkey, string pagename ) or NULL on error */ protected function getNamespaceKeyAndText( $ns, $text ) { - if ( $text == '' ) - return array( $ns, '', '' ); # shortcut for common case + if ( $text == '' ) { + # shortcut for common case + return array( $ns, '', '' ); + } $t = Title::makeTitleSafe( $ns, $text ); if ( $t && $t->isLocal() ) { diff --git a/includes/specials/SpecialAncientpages.php b/includes/specials/SpecialAncientpages.php index b0f333c45c..fafe75fd8c 100644 --- a/includes/specials/SpecialAncientpages.php +++ b/includes/specials/SpecialAncientpages.php @@ -43,12 +43,16 @@ class AncientPagesPage extends QueryPage { function getQueryInfo() { return array( 'tables' => array( 'page', 'revision' ), - 'fields' => array( 'namespace' => 'page_namespace', - 'title' => 'page_title', - 'value' => 'rev_timestamp' ), - 'conds' => array( 'page_namespace' => MWNamespace::getContentNamespaces(), - 'page_is_redirect' => 0, - 'page_latest=rev_id' ) + 'fields' => array( + 'namespace' => 'page_namespace', + 'title' => 'page_title', + 'value' => 'rev_timestamp' + ), + 'conds' => array( + 'page_namespace' => MWNamespace::getContentNamespaces(), + 'page_is_redirect' => 0, + 'page_latest=rev_id' + ) ); } diff --git a/includes/specials/SpecialBlankpage.php b/includes/specials/SpecialBlankpage.php index bfa2f951cb..e61f12b917 100644 --- a/includes/specials/SpecialBlankpage.php +++ b/includes/specials/SpecialBlankpage.php @@ -31,6 +31,7 @@ class SpecialBlankpage extends UnlistedSpecialPage { public function __construct() { parent::__construct( 'Blankpage' ); } + public function execute( $par ) { $this->setHeaders(); $this->getOutput()->addWikiMsg( 'intentionallyblankpage' ); diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 8dafbaeec3..53f7f4d616 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -110,10 +110,10 @@ class SpecialBlock extends FormSpecialPage { $s = HTMLForm::formatErrors( $this->preErrors ); if ( $s ) { $form->addHeaderText( Html::rawElement( - 'div', - array( 'class' => 'error' ), - $s - ) ); + 'div', + array( 'class' => 'error' ), + $s + ) ); } } } @@ -241,8 +241,7 @@ class SpecialBlock extends FormSpecialPage { if ( $block instanceof Block && !$block->mAuto # The block exists and isn't an autoblock && ( $this->type != Block::TYPE_RANGE # The block isn't a rangeblock || $block->getTarget() == $this->target ) # or if it is, the range is what we're about to block - ) - { + ) { $fields['HardBlock']['default'] = $block->isHardblock(); $fields['CreateAccount']['default'] = $block->prevents( 'createaccount' ); $fields['AutoBlock']['default'] = $block->isAutoblocking(); @@ -460,8 +459,8 @@ class SpecialBlock extends FormSpecialPage { $i = 0; $target = null; - while( true ) { - switch( $i++ ) { + while ( true ) { + switch ( $i++ ) { case 0: # The HTMLForm will check wpTarget first and only if it doesn't get # a value use the default, which will be generated from the options @@ -620,8 +619,8 @@ class SpecialBlock extends FormSpecialPage { # but $data['target'] gets overriden by (non-normalized) request variable # from previous request. if ( $target === $performer->getName() && - ( $data['PreviousTarget'] !== $target || !$data['Confirm'] ) ) - { + ( $data['PreviousTarget'] !== $target || !$data['Confirm'] ) + ) { return array( 'ipb-blockingself' ); } } elseif ( $type == Block::TYPE_RANGE ) { @@ -635,8 +634,8 @@ class SpecialBlock extends FormSpecialPage { } if ( ( strlen( $data['Expiry'] ) == 0 ) || ( strlen( $data['Expiry'] ) > 50 ) - || !self::parseExpiryInput( $data['Expiry'] ) ) - { + || !self::parseExpiryInput( $data['Expiry'] ) + ) { return array( 'ipb_expiry_invalid' ); } @@ -703,9 +702,9 @@ class SpecialBlock extends FormSpecialPage { $reblockNotAllowed = ( array_key_exists( 'Reblock', $data ) && !$data['Reblock'] ); # Show form unless the user is already aware of this... - if( $blockNotConfirmed || $reblockNotAllowed ) { + if ( $blockNotConfirmed || $reblockNotAllowed ) { return array( array( 'ipb_already_blocked', $block->getTarget() ) ); - # Otherwise, try to update the block... + # Otherwise, try to update the block... } else { # This returns direct blocks before autoblocks/rangeblocks, since we should # be sure the user is blocked by now it should work for our purposes @@ -865,7 +864,7 @@ class SpecialBlock extends FormSpecialPage { # User is trying to unblock themselves if ( $performer->isAllowed( 'unblockself' ) ) { return true; - # User blocked themselves and is now trying to reverse it + # User blocked themselves and is now trying to reverse it } elseif ( $performer->blockedBy() === $performer->getName() ) { return true; } else { diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index e10df4fe4d..17cc327e6f 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -55,7 +55,7 @@ class SpecialBlockList extends SpecialPage { $action = $request->getText( 'action' ); - if( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) { + if ( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) { # B/C @since 1.18: Unblock interface is now at Special:Unblock $title = SpecialPage::getTitleFor( 'Unblock', $this->target ); $out->redirect( $title->getFullUrl() ); @@ -120,7 +120,7 @@ class SpecialBlockList extends SpecialPage { if ( $this->target !== '' ) { list( $target, $type ) = Block::parseTarget( $this->target ); - switch( $type ) { + switch ( $type ) { case Block::TYPE_ID: case Block::TYPE_AUTO: $conds['ipb_id'] = $target; @@ -148,16 +148,16 @@ class SpecialBlockList extends SpecialPage { } # Apply filters - if( in_array( 'userblocks', $this->options ) ) { + if ( in_array( 'userblocks', $this->options ) ) { $conds['ipb_user'] = 0; } - if( in_array( 'tempblocks', $this->options ) ) { + if ( in_array( 'tempblocks', $this->options ) ) { $conds['ipb_expiry'] = 'infinity'; } - if( in_array( 'addressblocks', $this->options ) ) { + if ( in_array( 'addressblocks', $this->options ) ) { $conds[] = "ipb_user != 0 OR ipb_range_end > ipb_range_start"; } - if( in_array( 'rangeblocks', $this->options ) ) { + if ( in_array( 'rangeblocks', $this->options ) ) { $conds[] = "ipb_range_end = ipb_range_start"; } @@ -169,7 +169,7 @@ class SpecialBlockList extends SpecialPage { # Show additional header for the local block only when other blocks exists. # Not necessary in a standard installation without such extensions enabled - if( count( $otherBlockLink ) ) { + if ( count( $otherBlockLink ) ) { $out->addHTML( Html::element( 'h2', array(), $this->msg( 'ipblocklist-localblock' )->text() ) . "\n" ); @@ -179,8 +179,8 @@ class SpecialBlockList extends SpecialPage { if ( $pager->getNumRows() ) { $out->addHTML( $pager->getNavigationBar() . - $pager->getBody(). - $pager->getNavigationBar() + $pager->getBody() . + $pager->getNavigationBar() ); } elseif ( $this->target ) { @@ -190,7 +190,7 @@ class SpecialBlockList extends SpecialPage { $out->addWikiMsg( 'ipblocklist-empty' ); } - if( count( $otherBlockLink ) ) { + if ( count( $otherBlockLink ) ) { $out->addHTML( Html::rawElement( 'h2', @@ -199,7 +199,7 @@ class SpecialBlockList extends SpecialPage { ) . "\n" ); $list = ''; - foreach( $otherBlockLink as $link ) { + foreach ( $otherBlockLink as $link ) { $list .= Html::rawElement( 'li', array(), $link ) . "\n"; } $out->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" ); @@ -238,7 +238,7 @@ class BlockListPager extends TablePager { 'ipb_params' => 'blocklist-params', 'ipb_reason' => 'blocklist-reason', ); - foreach( $headers as $key => $val ) { + foreach ( $headers as $key => $val ) { $headers[$key] = $this->msg( $val )->text(); } } @@ -267,17 +267,17 @@ class BlockListPager extends TablePager { $formatted = ''; - switch( $name ) { + switch ( $name ) { case 'ipb_timestamp': $formatted = $this->getLanguage()->userTimeAndDate( $value, $this->getUser() ); break; case 'ipb_target': - if( $row->ipb_auto ) { + if ( $row->ipb_auto ) { $formatted = $this->msg( 'autoblockid', $row->ipb_id )->parse(); } else { list( $target, $type ) = Block::parseTarget( $row->ipb_address ); - switch( $type ) { + switch ( $type ) { case Block::TYPE_USER: case Block::TYPE_IP: $formatted = Linker::userLink( $target->getId(), $target ); @@ -295,9 +295,9 @@ class BlockListPager extends TablePager { break; case 'ipb_expiry': - $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */ true ); - if( $this->getUser()->isAllowed( 'block' ) ) { - if( $row->ipb_auto ) { + $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */true ); + if ( $this->getUser()->isAllowed( 'block' ) ) { + if ( $row->ipb_auto ) { $links[] = Linker::linkKnown( SpecialPage::getTitleFor( 'Unblock' ), $msg['unblocklink'], @@ -441,7 +441,7 @@ class BlockListPager extends TablePager { } $ua = UserArray::newFromIDs( $userids ); - foreach( $ua as $user ) { + foreach ( $ua as $user ) { $name = str_replace( ' ', '_', $user->getName() ); $lb->add( NS_USER, $name ); $lb->add( NS_USER_TALK, $name ); diff --git a/includes/specials/SpecialBlockme.php b/includes/specials/SpecialBlockme.php index 85a3019e8e..1e5b524408 100644 --- a/includes/specials/SpecialBlockme.php +++ b/includes/specials/SpecialBlockme.php @@ -39,7 +39,7 @@ class SpecialBlockme extends UnlistedSpecialPage { $this->outputHeader(); $ip = $this->getRequest()->getIP(); - if( !$wgBlockOpenProxies || $this->getRequest()->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { + if ( !$wgBlockOpenProxies || $this->getRequest()->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { $this->getOutput()->addWikiMsg( 'proxyblocker-disabled' ); return; } diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php index bdbd77b828..0774c44b85 100644 --- a/includes/specials/SpecialBooksources.php +++ b/includes/specials/SpecialBooksources.php @@ -53,8 +53,8 @@ class SpecialBookSources extends SpecialPage { $this->outputHeader(); $this->isbn = self::cleanIsbn( $isbn ? $isbn : $this->getRequest()->getText( 'isbn' ) ); $this->getOutput()->addHTML( $this->makeForm() ); - if( strlen( $this->isbn ) > 0 ) { - if( !self::isValidISBN( $this->isbn ) ) { + if ( strlen( $this->isbn ) > 0 ) { + if ( !self::isValidISBN( $this->isbn ) ) { $this->getOutput()->wrapWikiMsg( "
\n$1\n
", 'booksources-invalid-isbn' ); } $this->showList(); @@ -69,29 +69,29 @@ class SpecialBookSources extends SpecialPage { public static function isValidISBN( $isbn ) { $isbn = self::cleanIsbn( $isbn ); $sum = 0; - if( strlen( $isbn ) == 13 ) { - for( $i = 0; $i < 12; $i++ ) { - if( $i % 2 == 0 ) { + if ( strlen( $isbn ) == 13 ) { + for ( $i = 0; $i < 12; $i++ ) { + if ( $i % 2 == 0 ) { $sum += $isbn[$i]; } else { $sum += 3 * $isbn[$i]; } } - $check = (10 - ($sum % 10)) % 10; + $check = ( 10 - ( $sum % 10 ) ) % 10; if ( $check == $isbn[12] ) { return true; } - } elseif( strlen( $isbn ) == 10 ) { - for( $i = 0; $i < 9; $i++ ) { - $sum += $isbn[$i] * ($i + 1); + } elseif ( strlen( $isbn ) == 10 ) { + for ( $i = 0; $i < 9; $i++ ) { + $sum += $isbn[$i] * ( $i + 1 ); } $check = $sum % 11; - if( $check == 10 ) { + if ( $check == 10 ) { $check = "X"; } - if( $check == $isbn[9] ) { + if ( $check == $isbn[9] ) { return true; } } @@ -143,7 +143,7 @@ class SpecialBookSources extends SpecialPage { # Check for a local page such as Project:Book_sources and use that if available $page = $this->msg( 'booksources' )->inContentLanguage()->text(); $title = Title::makeTitleSafe( NS_PROJECT, $page ); # Show list in content language - if( is_object( $title ) && $title->exists() ) { + if ( is_object( $title ) && $title->exists() ) { $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); $content = $rev->getContent(); @@ -162,7 +162,7 @@ class SpecialBookSources extends SpecialPage { $this->getOutput()->addWikiMsg( 'booksources-text' ); $this->getOutput()->addHTML( '' ); return true; diff --git a/includes/specials/SpecialBrokenRedirects.php b/includes/specials/SpecialBrokenRedirects.php index fac412360d..e6fd58d22b 100644 --- a/includes/specials/SpecialBrokenRedirects.php +++ b/includes/specials/SpecialBrokenRedirects.php @@ -88,7 +88,7 @@ class BrokenRedirectsPage extends QueryPage { * @return array */ function getOrderFields() { - return array ( 'rd_namespace', 'rd_title', 'rd_from' ); + return array( 'rd_namespace', 'rd_title', 'rd_from' ); } /** @@ -138,7 +138,7 @@ class BrokenRedirectsPage extends QueryPage { $out = $from . $this->msg( 'word-separator' )->escaped(); - if( $this->getUser()->isAllowed( 'delete' ) ) { + if ( $this->getUser()->isAllowed( 'delete' ) ) { $links[] = Linker::linkKnown( $fromObj, $this->msg( 'brokenredirects-delete' )->escaped(), diff --git a/includes/specials/SpecialCategories.php b/includes/specials/SpecialCategories.php index f56ca52e01..f7256a4e2d 100644 --- a/includes/specials/SpecialCategories.php +++ b/includes/specials/SpecialCategories.php @@ -42,12 +42,12 @@ class SpecialCategories extends SpecialPage { $this->getOutput()->addHTML( Html::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) . - $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() . - $cap->getStartForm( $from ) . - $cap->getNavigationBar() . - '' . - $cap->getNavigationBar() . - Html::closeElement( 'div' ) + $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() . + $cap->getStartForm( $from ) . + $cap->getNavigationBar() . + '' . + $cap->getNavigationBar() . + Html::closeElement( 'div' ) ); } @@ -66,7 +66,7 @@ class CategoryPager extends AlphabeticPager { function __construct( IContextSource $context, $from ) { parent::__construct( $context ); $from = str_replace( ' ', '_', $from ); - if( $from !== '' ) { + if ( $from !== '' ) { $from = Title::capitalize( $from, NS_CATEGORY ); $this->setOffset( $from ); $this->setIncludeOffset( true ); @@ -92,6 +92,7 @@ class CategoryPager extends AlphabeticPager { unset( $this->mDefaultQuery['from'] ); return $this->mDefaultQuery; } + # protected function getOrderTypeMessages() { # return array( 'abc' => 'special-categories-sort-abc', # 'count' => 'special-categories-sort-count' ); @@ -126,12 +127,19 @@ class CategoryPager extends AlphabeticPager { public function getStartForm( $from ) { global $wgScript; - return Xml::tags( 'form', array( 'method' => 'get', 'action' => $wgScript ), - Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . - Xml::fieldset( $this->msg( 'categories' )->text(), - Xml::inputLabel( $this->msg( 'categoriesfrom' )->text(), + return Xml::tags( + 'form', + array( 'method' => 'get', 'action' => $wgScript ), + Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . + Xml::fieldset( + $this->msg( 'categories' )->text(), + Xml::inputLabel( + $this->msg( 'categoriesfrom' )->text(), 'from', 'from', 20, $from ) . - ' ' . - Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) ) ); + ' ' . + Xml::submitButton( $this->msg( 'allpagessubmit' )->text() + ) + ) + ); } } diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index 59a025780b..9ffbdf0f9d 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -89,8 +89,8 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $this->mNewEmail = $request->getVal( 'wpNewEmail' ); if ( $request->wasPosted() - && $user->matchEditToken( $request->getVal( 'token' ) ) ) - { + && $user->matchEditToken( $request->getVal( 'token' ) ) + ) { $info = $this->attemptChange( $user, $this->mPassword, $this->mNewEmail ); if ( $info === true ) { $this->doReturnTo(); @@ -138,15 +138,15 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $this->getOutput()->addHTML( Xml::fieldset( $this->msg( 'changeemail-header' )->text() ) . - Xml::openElement( 'form', - array( - 'method' => 'post', - 'action' => $this->getTitle()->getLocalUrl(), - 'id' => 'mw-changeemail-form' ) ) . "\n" . - Html::hidden( 'token', $user->getEditToken() ) . "\n" . - Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" . - $this->msg( 'changeemail-text' )->parseAsBlock() . "\n" . - Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n" + Xml::openElement( 'form', + array( + 'method' => 'post', + 'action' => $this->getTitle()->getLocalUrl(), + 'id' => 'mw-changeemail-form' ) ) . "\n" . + Html::hidden( 'token', $user->getEditToken() ) . "\n" . + Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" . + $this->msg( 'changeemail-text' )->parseAsBlock() . "\n" . + Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n" ); $items = array( array( 'wpName', 'username', 'text', $user->getName() ), @@ -159,17 +159,17 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $this->getOutput()->addHTML( $this->pretty( $items ) . - "\n" . - "\n" . + "\n" . + "\n" . "\n" . '' . - Xml::submitButton( $this->msg( 'changeemail-submit' )->text() ) . - Xml::submitButton( $this->msg( 'changeemail-cancel' )->text(), array( 'name' => 'wpCancel' ) ) . + Xml::submitButton( $this->msg( 'changeemail-submit' )->text() ) . + Xml::submitButton( $this->msg( 'changeemail-cancel' )->text(), array( 'name' => 'wpCancel' ) ) . "\n" . - "\n" . - Xml::closeElement( 'table' ) . - Xml::closeElement( 'form' ) . - Xml::closeElement( 'fieldset' ) . "\n" + "\n" . + Xml::closeElement( 'table' ) . + Xml::closeElement( 'form' ) . + Xml::closeElement( 'fieldset' ) . "\n" ); } @@ -181,7 +181,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $out = ''; foreach ( $fields as $list ) { list( $name, $label, $type, $value ) = $list; - if( $type == 'text' ) { + if ( $type == 'text' ) { $field = htmlspecialchars( $value ); } else { $attribs = array( 'id' => $name ); @@ -241,8 +241,8 @@ class SpecialChangeEmail extends UnlistedSpecialPage { if ( !$status->isGood() ) { $this->getOutput()->addHTML( '

' . - $this->getOutput()->parseInline( $status->getWikiText( 'mailerror' ) ) . - '

' ); + $this->getOutput()->parseInline( $status->getWikiText( 'mailerror' ) ) . + '

' ); return false; } diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index 73eb97fdeb..09531b2b00 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -52,46 +52,46 @@ class SpecialChangePassword extends UnlistedSpecialPage { $this->mDomain = $request->getVal( 'wpDomain' ); $user = $this->getUser(); - if( !$request->wasPosted() && !$user->isLoggedIn() ) { + if ( !$request->wasPosted() && !$user->isLoggedIn() ) { $this->error( $this->msg( 'resetpass-no-info' )->text() ); return; } - if( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) { + if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) { $this->doReturnTo(); return; } $this->checkReadOnly(); - if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) { + if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) { try { $this->mDomain = $wgAuth->getDomain(); - if( !$wgAuth->allowPasswordChange() ) { + if ( !$wgAuth->allowPasswordChange() ) { $this->error( $this->msg( 'resetpass_forbidden' )->text() ); return; } $this->attemptReset( $this->mNewpass, $this->mRetype ); - if( $user->isLoggedIn() ) { + if ( $user->isLoggedIn() ) { $this->doReturnTo(); } else { LoginForm::setLoginToken(); $token = LoginForm::getLoginToken(); $data = array( - 'action' => 'submitlogin', - 'wpName' => $this->mUserName, - 'wpDomain' => $this->mDomain, + 'action' => 'submitlogin', + 'wpName' => $this->mUserName, + 'wpDomain' => $this->mDomain, 'wpLoginToken' => $token, - 'wpPassword' => $request->getVal( 'wpNewPassword' ), + 'wpPassword' => $request->getVal( 'wpNewPassword' ), ) + $request->getValues( 'wpRemember', 'returnto', 'returntoquery' ); $login = new LoginForm( new FauxRequest( $data, true ) ); $login->setContext( $this->getContext() ); $login->execute( null ); } return; - } catch( PasswordError $e ) { + } catch ( PasswordError $e ) { $this->error( $e->getMessage() ); } } @@ -127,12 +127,12 @@ class SpecialChangePassword extends UnlistedSpecialPage { $rememberMe = '' . '' . '' . - Xml::checkLabel( - $this->msg( 'remembermypassword' )->numParams( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) )->text(), - 'wpRemember', 'wpRemember', - $this->getRequest()->getCheck( 'wpRemember' ) ) . + Xml::checkLabel( + $this->msg( 'remembermypassword' )->numParams( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) )->text(), + 'wpRemember', 'wpRemember', + $this->getRequest()->getCheck( 'wpRemember' ) ) . '' . - ''; + ''; $submitMsg = 'resetpass_submit'; $oldpassMsg = 'resetpass-temp-password'; } else { @@ -142,11 +142,11 @@ class SpecialChangePassword extends UnlistedSpecialPage { $extraFields = array(); wfRunHooks( 'ChangePasswordForm', array( &$extraFields ) ); $prettyFields = array( - array( 'wpName', 'username', 'text', $this->mUserName ), - array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ), - array( 'wpNewPassword', 'newpassword', 'password', null ), - array( 'wpRetype', 'retypenew', 'password', null ), - ); + array( 'wpName', 'username', 'text', $this->mUserName ), + array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ), + array( 'wpNewPassword', 'newpassword', 'password', null ), + array( 'wpRetype', 'retypenew', 'password', null ), + ); $prettyFields = array_merge( $prettyFields, $extraFields ); $hiddenFields = array( 'token' => $user->getEditToken(), @@ -154,31 +154,31 @@ class SpecialChangePassword extends UnlistedSpecialPage { 'wpDomain' => $this->mDomain, ) + $this->getRequest()->getValues( 'returnto', 'returntoquery' ); $hiddenFieldsStr = ''; - foreach( $hiddenFields as $fieldname => $fieldvalue ) { + foreach ( $hiddenFields as $fieldname => $fieldvalue ) { $hiddenFieldsStr .= Html::hidden( $fieldname, $fieldvalue ) . "\n"; } $this->getOutput()->addHTML( Xml::fieldset( $this->msg( 'resetpass_header' )->text() ) . - Xml::openElement( 'form', - array( - 'method' => 'post', - 'action' => $this->getTitle()->getLocalUrl(), - 'id' => 'mw-resetpass-form' ) ) . "\n" . - $hiddenFieldsStr . - $this->msg( 'resetpass_text' )->parseAsBlock() . "\n" . - Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" . - $this->pretty( $prettyFields ) . "\n" . - $rememberMe . - "\n" . + Xml::openElement( 'form', + array( + 'method' => 'post', + 'action' => $this->getTitle()->getLocalUrl(), + 'id' => 'mw-resetpass-form' ) ) . "\n" . + $hiddenFieldsStr . + $this->msg( 'resetpass_text' )->parseAsBlock() . "\n" . + Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" . + $this->pretty( $prettyFields ) . "\n" . + $rememberMe . + "\n" . "\n" . '' . - Xml::submitButton( $this->msg( $submitMsg )->text() ) . - Xml::submitButton( $this->msg( 'resetpass-submit-cancel' )->text(), array( 'name' => 'wpCancel' ) ) . + Xml::submitButton( $this->msg( $submitMsg )->text() ) . + Xml::submitButton( $this->msg( 'resetpass-submit-cancel' )->text(), array( 'name' => 'wpCancel' ) ) . "\n" . - "\n" . - Xml::closeElement( 'table' ) . - Xml::closeElement( 'form' ) . - Xml::closeElement( 'fieldset' ) . "\n" + "\n" . + Xml::closeElement( 'table' ) . + Xml::closeElement( 'form' ) . + Xml::closeElement( 'fieldset' ) . "\n" ); } @@ -190,7 +190,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { $out = ''; foreach ( $fields as $list ) { list( $name, $label, $type, $value ) = $list; - if( $type == 'text' ) { + if ( $type == 'text' ) { $field = htmlspecialchars( $value ); } else { $attribs = array( 'id' => $name ); @@ -205,10 +205,13 @@ class SpecialChangePassword extends UnlistedSpecialPage { } $out .= "\n"; $out .= "\t"; - if ( $type != 'text' ) + + if ( $type != 'text' ) { $out .= Xml::label( $this->msg( $label )->text(), $name ); - else + } else { $out .= $this->msg( $label )->escaped(); + } + $out .= "\n"; $out .= "\t"; $out .= $field; @@ -229,11 +232,11 @@ class SpecialChangePassword extends UnlistedSpecialPage { $user = User::newFromName( $this->mUserName ); } - if( !$user || $user->isAnon() ) { + if ( !$user || $user->isAnon() ) { throw new PasswordError( $this->msg( 'nosuchusershort', $this->mUserName )->text() ); } - if( $newpass !== $retype ) { + if ( $newpass !== $retype ) { wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'badretype' ) ); throw new PasswordError( $this->msg( 'badretype' )->text() ); } @@ -243,7 +246,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { throw new PasswordError( $this->msg( 'login-throttled' )->text() ); } - if( !$user->checkTemporaryPassword( $this->mOldpass ) && !$user->checkPassword( $this->mOldpass ) ) { + if ( !$user->checkTemporaryPassword( $this->mOldpass ) && !$user->checkPassword( $this->mOldpass ) ) { wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'wrongpassword' ) ); throw new PasswordError( $this->msg( 'resetpass-wrong-oldpass' )->text() ); } @@ -257,7 +260,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { $user->setPassword( $this->mNewpass ); wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'success' ) ); $this->mNewpass = $this->mOldpass = $this->mRetype = ''; - } catch( PasswordError $e ) { + } catch ( PasswordError $e ) { wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) ); throw new PasswordError( $e->getMessage() ); } diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php index c3bd3feccf..3b82326bcb 100644 --- a/includes/specials/SpecialComparePages.php +++ b/includes/specials/SpecialComparePages.php @@ -110,7 +110,7 @@ class SpecialComparePages extends SpecialPage { $rev1 = self::revOrTitle( $data['Revision1'], $data['Page1'] ); $rev2 = self::revOrTitle( $data['Revision2'], $data['Page2'] ); - if( $rev1 && $rev2 ) { + if ( $rev1 && $rev2 ) { $revision = Revision::newFromId( $rev1 ); if ( $revision ) { // NOTE: $rev1 was already checked, should exist. @@ -128,11 +128,11 @@ class SpecialComparePages extends SpecialPage { } public static function revOrTitle( $revision, $title ) { - if( $revision ) { + if ( $revision ) { return $revision; - } elseif( $title ) { + } elseif ( $title ) { $title = Title::newFromText( $title ); - if( $title instanceof Title ) { + if ( $title instanceof Title ) { return $title->getLatestRevID(); } }